package com.gxuwz.PangGuangyao.business.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.gxuwz.PangGuangyao.business.entity.SysSchool;
import com.gxuwz.core.dao.impl.BaseDaoImpl;
import com.gxuwz.core.pagination.Result;

@Repository("sysSchoolDAO")
public class SysSchoolDAO extends BaseDaoImpl<SysSchool>{
	
	/**
	 * 根据条件查找分页
	 */
	@SuppressWarnings("unchecked")
	public Result<SysSchool> find(SysSchool sysSchool, int page, int row){
		String queryString="from SysSchool where 1=1";
		if(null != sysSchool.getSchoolId()){
			queryString = queryString + " and schoolId like '%"+sysSchool.getSchoolId()+"%'";
		}
		int start=(page-1)*row;
		int limit =row;
		
		return (Result<SysSchool>)super.find(queryString, null, null, start, limit);
	}
	/**
	 * 查询所有
	 */
	public List<SysSchool> getAllSchool(){
		String queryString="from SysSchool where 1=1 ";
		return getHibernateTemplate().find(queryString);
	}
}
